package com.xbongbong.pro.weblist.pojo;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.toolbox.wrap.BaseVO;
import lombok.Getter;
import lombok.Setter;

/**
 * 附近客户列表
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/2/25 9:23
 * @since v1.0
 */
@Getter
@Setter
public class NearCustomerPojo extends BaseVO {
    private Long id;
    private String address;
    private Integer isPublic;
    /**
     * 是否归档客户
     */
    private Integer isArchived;
    /**
     * 标签池
     */
    private JSONObject tagData;

    private String lastConnectTimeStr;
    private Integer lastConnectTime;
    private Double distance;
    private Double latitude;
    private Double longitude;
    private String manager;
    private String name;
    private String phone;
    private String Type;
    private Long addTime;
    private Long updateTime;

    public void setIsPublic(Integer isPublic) {
        this.isPublic = isPublic == null ? 0 : isPublic;
    }

    public NearCustomerPojo() {
        this.longitude = 0D;
        this.latitude = 0D;
    }

    public void mergeAddress(JSONObject data) {
        try {
            this.address = data.getString("province") + data.getString("city") + data.getString("district") + data.getString("address");
        }catch (Exception e){
            this.address = "";
        }
    }
}
